package com.example.film.mapper;

import com.example.film.entity.FilmComment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface FilmCommentMapper {
    //top250电影评论table-->filmcomment
    //根据电影排名查找评论
    @Select("select userName,imag,comment,commentDate,likeNumber,filmRank from filmcomment where filmRank=#{filmRank}")
    List<FilmComment> findFilmCommentByRank(Integer filmRank);

    //分页查询电影评论
    @Select("select userName,imag,comment,commentDate,likeNumber,filmRank from filmcomment where filmRank=#{filmRank} LIMIT #{pageSize} OFFSET #{startIndex}")
    List<FilmComment> findFilmCommentInfo(@Param("filmRank") Integer filmRank,@Param("startIndex") Integer startIndex, @Param("pageSize") Integer pageSize);
}
